package com.zysstudy.controller;

import com.zysstudy.domain.Room;
import com.zysstudy.service.RoomService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author zhaoyoushui
 * @date 2023/9/7 15:19
 */

@RestController
public class RoomController {
    @Autowired
    RoomService roomService;

    @GetMapping("room/list/{areaId}")
    public List<Room> getRoomList(@PathVariable("areaId") int areaId) {
        return roomService.findByAreaId(areaId);
    }

    @GetMapping("room/detail/{id}")
    public Room getRoomDetail(@PathVariable("id") int id) {
        return roomService.findById(id);
    }
}
